3.708 \(\int \frac{(A+B \tan (e+f x)) (c-i c \tan (e+f x))^2}{a+i a \tan (e+f x)} \, dx\)

Optimal. Leaf size=96 \[ -\frac{2 c^2 (A+i B)}{a f (-\tan (e+f x)+i)}-\frac{c^2 (-3 B+i A) \log (\cos (e+f x))}{a f}-\frac{c^2 x (A+3 i B)}{a}+\frac{i B c^2 \tan (e+f x)}{a f} \]

[Out]

-(((A + (3*I)*B)*c^2*x)/a) - ((I*A - 3*B)*c^2*Log[Cos[e + f*x]])/(a*f) - (2*(A + I*B)*c^2)/(a*f*(I - Tan[e + f
*x])) + (I*B*c^2*Tan[e + f*x])/(a*f)

________________________________________________________________________________________

Rubi [A]  time = 0.159317, antiderivative size = 96, normalized size of antiderivative = 1., number of steps used = 3, number of rules used = 2, integrand size = 41, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.049, Rules used = {3588, 77} \[ -\frac{2 c^2 (A+i B)}{a f (-\tan (e+f x)+i)}-\frac{c^2 (-3 B+i A) \log (\cos (e+f x))}{a f}-\frac{c^2 x (A+3 i B)}{a}+\frac{i B c^2 \tan (e+f x)}{a f} \]

Antiderivative was successfully verified.

[In]

Int[((A + B*Tan[e + f*x])*(c - I*c*Tan[e + f*x])^2)/(a + I*a*Tan[e + f*x]),x]

[Out]

-(((A + (3*I)*B)*c^2*x)/a) - ((I*A - 3*B)*c^2*Log[Cos[e + f*x]])/(a*f) - (2*(A + I*B)*c^2)/(a*f*(I - Tan[e + f
*x])) + (I*B*c^2*Tan[e + f*x])/(a*f)

Rule 3588

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_) + (d_.)*tan[(e_
.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Dist[(a*c)/f, Subst[Int[(a + b*x)^(m - 1)*(c + d*x)^(n - 1)*(A + B*x), x
], x, Tan[e + f*x]], x] /; FreeQ[{a, b, c, d, e, f, A, B, m, n}, x] && EqQ[b*c + a*d, 0] && EqQ[a^2 + b^2, 0]

Rule 77

Int[((a_.) + (b_.)*(x_))*((c_) + (d_.)*(x_))^(n_.)*((e_.) + (f_.)*(x_))^(p_.), x_Symbol] :> Int[ExpandIntegran
d[(a + b*x)*(c + d*x)^n*(e + f*x)^p, x], x] /; FreeQ[{a, b, c, d, e, f, n}, x] && NeQ[b*c - a*d, 0] && ((ILtQ[
n, 0] && ILtQ[p, 0]) || EqQ[p, 1] || (IGtQ[p, 0] && ( !IntegerQ[n] || LeQ[9*p + 5*(n + 2), 0] || GeQ[n + p + 1
, 0] || (GeQ[n + p + 2, 0] && RationalQ[a, b, c, d, e, f]))))

Rubi steps

\begin{align*} \int \frac{(A+B \tan (e+f x)) (c-i c \tan (e+f x))^2}{a+i a \tan (e+f x)} \, dx &=\frac{(a c) \operatorname{Subst}\left (\int \frac{(A+B x) (c-i c x)}{(a+i a x)^2} \, dx,x,\tan (e+f x)\right )}{f}\\ &=\frac{(a c) \operatorname{Subst}\left (\int \left (\frac{i B c}{a^2}-\frac{2 (A+i B) c}{a^2 (-i+x)^2}+\frac{i (A+3 i B) c}{a^2 (-i+x)}\right ) \, dx,x,\tan (e+f x)\right )}{f}\\ &=-\frac{(A+3 i B) c^2 x}{a}-\frac{(i A-3 B) c^2 \log (\cos (e+f x))}{a f}-\frac{2 (A+i B) c^2}{a f (i-\tan (e+f x))}+\frac{i B c^2 \tan (e+f x)}{a f}\\ \end{align*}

Mathematica [A]  time = 3.61088, size = 184, normalized size = 1.92 \[ \frac{c^2 (\cos (f x)+i \sin (f x)) (A+B \tan (e+f x)) \left (2 (A+i B) (\sin (e)+i \cos (e)) \cos (2 f x)+2 (A+i B) (\cos (e)-i \sin (e)) \sin (2 f x)+(3 B-i A) (\cos (e)+i \sin (e)) \log \left (\cos ^2(e+f x)\right )-2 (A+3 i B) (\cos (e)+i \sin (e)) \tan ^{-1}(\tan (f x))-2 B (\tan (e)-i) \sin (f x) \sec (e+f x)\right )}{2 f (a+i a \tan (e+f x)) (A \cos (e+f x)+B \sin (e+f x))} \]

Antiderivative was successfully verified.

[In]

Integrate[((A + B*Tan[e + f*x])*(c - I*c*Tan[e + f*x])^2)/(a + I*a*Tan[e + f*x]),x]

[Out]

(c^2*(Cos[f*x] + I*Sin[f*x])*(-2*(A + (3*I)*B)*ArcTan[Tan[f*x]]*(Cos[e] + I*Sin[e]) + ((-I)*A + 3*B)*Log[Cos[e
 + f*x]^2]*(Cos[e] + I*Sin[e]) + 2*(A + I*B)*Cos[2*f*x]*(I*Cos[e] + Sin[e]) + 2*(A + I*B)*(Cos[e] - I*Sin[e])*
Sin[2*f*x] - 2*B*Sec[e + f*x]*Sin[f*x]*(-I + Tan[e]))*(A + B*Tan[e + f*x]))/(2*f*(A*Cos[e + f*x] + B*Sin[e + f
*x])*(a + I*a*Tan[e + f*x]))

________________________________________________________________________________________

Maple [A]  time = 0.04, size = 113, normalized size = 1.2 \begin{align*}{\frac{iB{c}^{2}\tan \left ( fx+e \right ) }{af}}+{\frac{2\,iB{c}^{2}}{af \left ( \tan \left ( fx+e \right ) -i \right ) }}+2\,{\frac{A{c}^{2}}{af \left ( \tan \left ( fx+e \right ) -i \right ) }}+{\frac{iA{c}^{2}\ln \left ( \tan \left ( fx+e \right ) -i \right ) }{af}}-3\,{\frac{B{c}^{2}\ln \left ( \tan \left ( fx+e \right ) -i \right ) }{af}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((A+B*tan(f*x+e))*(c-I*c*tan(f*x+e))^2/(a+I*a*tan(f*x+e)),x)

[Out]

I*B*c^2*tan(f*x+e)/a/f+2*I/f*c^2/a/(tan(f*x+e)-I)*B+2/f*c^2/a/(tan(f*x+e)-I)*A+I/f*c^2/a*A*ln(tan(f*x+e)-I)-3/
f*c^2/a*B*ln(tan(f*x+e)-I)

________________________________________________________________________________________

Maxima [F(-2)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: RuntimeError} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((A+B*tan(f*x+e))*(c-I*c*tan(f*x+e))^2/(a+I*a*tan(f*x+e)),x, algorithm="maxima")

[Out]

Exception raised: RuntimeError

________________________________________________________________________________________

Fricas [A]  time = 1.74628, size = 387, normalized size = 4.03 \begin{align*} -\frac{2 \,{\left (A + 3 i \, B\right )} c^{2} f x e^{\left (4 i \, f x + 4 i \, e\right )} -{\left (i \, A - B\right )} c^{2} +{\left (2 \,{\left (A + 3 i \, B\right )} c^{2} f x -{\left (i \, A - 3 \, B\right )} c^{2}\right )} e^{\left (2 i \, f x + 2 i \, e\right )} -{\left ({\left (-i \, A + 3 \, B\right )} c^{2} e^{\left (4 i \, f x + 4 i \, e\right )} +{\left (-i \, A + 3 \, B\right )} c^{2} e^{\left (2 i \, f x + 2 i \, e\right )}\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right )}{a f e^{\left (4 i \, f x + 4 i \, e\right )} + a f e^{\left (2 i \, f x + 2 i \, e\right )}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((A+B*tan(f*x+e))*(c-I*c*tan(f*x+e))^2/(a+I*a*tan(f*x+e)),x, algorithm="fricas")

[Out]

-(2*(A + 3*I*B)*c^2*f*x*e^(4*I*f*x + 4*I*e) - (I*A - B)*c^2 + (2*(A + 3*I*B)*c^2*f*x - (I*A - 3*B)*c^2)*e^(2*I
*f*x + 2*I*e) - ((-I*A + 3*B)*c^2*e^(4*I*f*x + 4*I*e) + (-I*A + 3*B)*c^2*e^(2*I*f*x + 2*I*e))*log(e^(2*I*f*x +
 2*I*e) + 1))/(a*f*e^(4*I*f*x + 4*I*e) + a*f*e^(2*I*f*x + 2*I*e))

________________________________________________________________________________________

Sympy [A]  time = 5.1859, size = 184, normalized size = 1.92 \begin{align*} - \frac{2 B c^{2} e^{- 2 i e}}{a f \left (e^{2 i f x} + e^{- 2 i e}\right )} + \frac{c^{2} \left (- i A + 3 B\right ) \log{\left (e^{2 i f x} + e^{- 2 i e} \right )}}{a f} - \frac{\left (\begin{cases} 2 A c^{2} x e^{2 i e} - \frac{i A c^{2} e^{- 2 i f x}}{f} + 6 i B c^{2} x e^{2 i e} + \frac{B c^{2} e^{- 2 i f x}}{f} & \text{for}\: f \neq 0 \\x \left (2 A c^{2} e^{2 i e} - 2 A c^{2} + 6 i B c^{2} e^{2 i e} - 2 i B c^{2}\right ) & \text{otherwise} \end{cases}\right ) e^{- 2 i e}}{a} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((A+B*tan(f*x+e))*(c-I*c*tan(f*x+e))**2/(a+I*a*tan(f*x+e)),x)

[Out]

-2*B*c**2*exp(-2*I*e)/(a*f*(exp(2*I*f*x) + exp(-2*I*e))) + c**2*(-I*A + 3*B)*log(exp(2*I*f*x) + exp(-2*I*e))/(
a*f) - Piecewise((2*A*c**2*x*exp(2*I*e) - I*A*c**2*exp(-2*I*f*x)/f + 6*I*B*c**2*x*exp(2*I*e) + B*c**2*exp(-2*I
*f*x)/f, Ne(f, 0)), (x*(2*A*c**2*exp(2*I*e) - 2*A*c**2 + 6*I*B*c**2*exp(2*I*e) - 2*I*B*c**2), True))*exp(-2*I*
e)/a

________________________________________________________________________________________

Giac [B]  time = 1.33605, size = 385, normalized size = 4.01 \begin{align*} \frac{\frac{2 \,{\left (i \, A c^{2} - 3 \, B c^{2}\right )} \log \left (\tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right ) - i\right )}{a} + \frac{{\left (-i \, A c^{2} + 3 \, B c^{2}\right )} \log \left ({\left | \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right ) + 1 \right |}\right )}{a} - \frac{{\left (i \, A c^{2} - 3 \, B c^{2}\right )} \log \left ({\left | \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right ) - 1 \right |}\right )}{a} - \frac{-i \, A c^{2} \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right )^{2} + 3 \, B c^{2} \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right )^{2} + 2 i \, B c^{2} \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right ) + i \, A c^{2} - 3 \, B c^{2}}{{\left (\tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right )^{2} - 1\right )} a} - \frac{3 i \, A c^{2} \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right )^{2} - 9 \, B c^{2} \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right )^{2} + 10 \, A c^{2} \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right ) + 22 i \, B c^{2} \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right ) - 3 i \, A c^{2} + 9 \, B c^{2}}{a{\left (\tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right ) - i\right )}^{2}}}{f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((A+B*tan(f*x+e))*(c-I*c*tan(f*x+e))^2/(a+I*a*tan(f*x+e)),x, algorithm="giac")

[Out]

(2*(I*A*c^2 - 3*B*c^2)*log(tan(1/2*f*x + 1/2*e) - I)/a + (-I*A*c^2 + 3*B*c^2)*log(abs(tan(1/2*f*x + 1/2*e) + 1
))/a - (I*A*c^2 - 3*B*c^2)*log(abs(tan(1/2*f*x + 1/2*e) - 1))/a - (-I*A*c^2*tan(1/2*f*x + 1/2*e)^2 + 3*B*c^2*t
an(1/2*f*x + 1/2*e)^2 + 2*I*B*c^2*tan(1/2*f*x + 1/2*e) + I*A*c^2 - 3*B*c^2)/((tan(1/2*f*x + 1/2*e)^2 - 1)*a) -
 (3*I*A*c^2*tan(1/2*f*x + 1/2*e)^2 - 9*B*c^2*tan(1/2*f*x + 1/2*e)^2 + 10*A*c^2*tan(1/2*f*x + 1/2*e) + 22*I*B*c
^2*tan(1/2*f*x + 1/2*e) - 3*I*A*c^2 + 9*B*c^2)/(a*(tan(1/2*f*x + 1/2*e) - I)^2))/f